// Created by Roman Novitsky on 02.06.2009


#region Imported Namespaces


using System.Collections.Generic;
using System.Windows.Input;


#endregion


namespace WtfManager.UIManager.Commands
{
  public class OpenInNewTabCommandHandler: OpenCommandHandlerBase
  {
    #region Properties/Indexers


    public override ICommand Command
    {
      get
      {
        return WtfNavigationCommands.OpenInNewTab;
      }
    }

    public override string Description
    {
      get
      {
        return "Handles 'Open in New Tab' command.";
      }
    }

    public override string Name
    {
      get
      {
        return "Open in New Tab Command Handler";
      }
    }


    #endregion


    #region Methods


    protected override bool CanExecute(List<object> itemsToOpen)
    {
      if (itemsToOpen.Count == 0)
      {
        return false;
      }

      foreach (object item in itemsToOpen)
      {
        if (CanOpenInNewTab(item))
        {
          return true;
        }
      }

      return false;
    }


    protected override void Execute(List<object> itemsToOpen)
    {
      foreach (object item in itemsToOpen)
      {
        OpenInNewTab(item);
      }
    }


    #endregion
  }
}